package com.devilvan.betrice.lol.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.devilvan.betrice.common.BasePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author Evad.Wu
 * @Description LOL-对局基本信息 映射
 * @date 2022-09-30
 */
@Setter
@Getter
@ToString(exclude = {"lolBattleTeamPoList", "lolBattleChampionPoList"})
@NoArgsConstructor
@Accessors(chain = true)
@TableName(value = "LOL_BATTLE_HEADER")

@Entity
@Table(name = "LOL_BATTLE_HEADER")
@DynamicInsert
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "LOL-对局基本信息 映射")
public class LolBattleHeaderPo extends BasePo implements Serializable {
    @Serial
    private static final long serialVersionUID = 2079607483600899949L;
    @Schema(description = "对局ID")
    @TableField(value = "GAME_ID")
    @Column(name = "GAME_ID", columnDefinition = "BIGINT(19) NOT NULL COMMENT '对局ID'")
    private Long gameId;
    @Schema(description = "大区ID")
    @TableField(value = "AREA_ID")
    @Column(name = "AREA_ID", columnDefinition = "INT(10) COMMENT '大区ID'")
    private Integer areaId;
    @Schema(description = "游戏开始时间")
    @TableField(value = "GAME_START_TIME")
    @Column(name = "GAME_START_TIME", columnDefinition = "DATETIME NOT NULL COMMENT '游戏开始时间'")
    private Date gameStartTime;
    @Schema(description = "游戏时间")
    @TableField(value = "GAME_TIME_PLAYED")
    @Column(name = "GAME_TIME_PLAYED", columnDefinition = "INT(10) NOT NULL COMMENT '游戏时间'")
    private Integer gameTimePlayed;
    @Schema(description = "地图ID")
    @TableField(value = "MAP_ID")
    @Column(name = "MAP_ID", columnDefinition = "INT(10) COMMENT '地图ID'")
    private Integer mapId;
    @Schema(description = "队列ID")
    @TableField(value = "GAME_QUEUE_ID")
    @Column(name = "GAME_QUEUE_ID", columnDefinition = "INT(10) COMMENT '队列ID'")
    private Integer gameQueueId;
    @Schema(description = "游戏模式")
    @TableField(value = "GAME_MODE")
    @Column(name = "GAME_MODE", columnDefinition = "VARCHAR(32) COMMENT '游戏模式'")
    private String gameMode;
    @Schema(description = "游戏类型")
    @TableField(value = "GAME_TYPE")
    @Column(name = "GAME_TYPE", columnDefinition = "VARCHAR(32) COMMENT '游戏类型'")
    private String gameType;
    @Schema(description = "是否提前投降")
    @TableField(value = "WAS_EARLY_SURRENDER")
    @Column(name = "WAS_EARLY_SURRENDER", columnDefinition = "BIT(1) COMMENT '是否提前投降'")
    private Boolean wasEarlySurrender;
    @Schema(description = "是否超过25分钟")
    @TableField(value = "PLAY_GT25_MASK")
    @Column(name = "PLAY_GT25_MASK", columnDefinition = "BIT(1) COMMENT '是否超过25分钟'")
    private Boolean playGt25Mask;
    @Schema(description = "游戏版本")
    @TableField(value = "GAME_SERVER_VERSION")
    @Column(name = "GAME_SERVER_VERSION", columnDefinition = "VARCHAR(16) COMMENT '游戏版本'")
    private String gameServerVersion;

    @Schema(description = "对局队伍信息")
    @TableField(exist = false)
    @OneToMany(targetEntity = LolBattleTeamPo.class, mappedBy = "lolBattleHeaderPo", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<LolBattleTeamPo> lolBattleTeamPoList;
    @Schema(description = "对局英雄信息")
    @TableField(exist = false)
    @OneToMany(targetEntity = LolBattleChampionPo.class, mappedBy = "lolBattleHeaderPo", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private List<LolBattleChampionPo> lolBattleChampionPoList;
}
